﻿<UserControl x:Class="GenericDesigner"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:local="clr-namespace:CASI.UI"
    mc:Ignorable="d" 
    d:DesignHeight="300" d:DesignWidth="300">
    
    <UserControl.Resources>
        <ResourceDictionary>
            <local:WidthConverter x:Key="WidthConverter" />
        </ResourceDictionary>
    </UserControl.Resources>
    
    <Grid>
        <ScrollViewer>
            <ListBox x:Name="UxPropertyObjects" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Width="{Binding ViewportWidth, Converter={StaticResource WidthConverter}, ConverterParameter=2, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ScrollViewer}}}">
                            <TextBlock FontWeight="Bold" Text="{Binding PropertyName}" HorizontalAlignment="Stretch" />
                            <local:GenericEditor ScriptProperty="{Binding}" HorizontalAlignment="Stretch" />
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </ScrollViewer>
    </Grid>
</UserControl>
